<script>
import {mapState} from 'vuex';

export default {
  onLaunch: function () {
    if (!this.hasLogin) {
      return;
    }
    uni.$off();
    //我是全局事件订阅的调用方法
    uni.$on('leftExpandEvent', async res => {
      this.init(res);
    });
    this.$watermark.set(this.userInfo.name || '');
    this.init(!this.leftMensHide);
  },
  onHide: function () {
  },
  computed: {
    ...mapState(['hasLogin', 'leftMensHide', 'userInfo'])
  },
  methods: {
    init(status) {
      let dom = document.getElementsByTagName('uni-main')[0];
      if (!status) {
        let att = document.createAttribute('class');
        att.value = 'uni-page-body-off';
        dom.setAttributeNode(att);
      } else {
        dom.removeAttribute('class');
      }
    }
  }
};
</script>

<style lang="scss">
*,
:after,
:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/*每个页面公共css */
body {
  background-color: #e9ebed !important;
  color: rgba(0, 0, 0, 0.85);
  font-variant: tabular-nums;
  font-feature-settings: 'tnum', 'tnum';
  font-size: 12px;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
}

page,
view {
  box-sizing: border-box;
}

page {
  -webkit-user-select: text;
  user-select: text;
  height: auto;
  width: 100%;
  z-index: 9;
}

@media screen and (max-width: 300px) {
  .page-container {
    padding: 0 16px 16px 16px;
  }
}

.uni-page-body-off {
  .page-container {
    padding: 0 16px 16px 66px;
  }
}

::-webkit-scrollbar {
  width: 2px;
  height: 15px;
  border-radius: 10px;
  cursor: pointer;
  background-color: transparent;
  // background-color: rgba(235, 238 ,243,1);
}

::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  border-radius: 10px;
  display: none;
}

::-webkit-scrollbar-corner {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  display: inline-block;
  background-color: rgba(51, 72, 103, 0.5);
  border-radius: 25px;
  // border: 0px solid rgba(51, 72, 103, .5);
  border: none;
}

.uni-top-window {
  overflow: inherit;
}

uni-left-window {
  overflow-x: inherit;
}

.page-container {
  padding: 0 16px 16px 216px;
  width: 100%;
  height: 100%;
  min-width: 768px;
  min-height: 700px;
  box-sizing: border-box;
}

.wall-view {
  width: 100%;
  height: 15px;
}

/* 左侧菜单popvover样式 */
.popover-menu {
  background-color: #001529 !important;
  min-width: 50px !important;
  border: 1px solid #001529 !important;
  border-radius: 5px !important;
  width: auto !important;
  left: 45px !important;

  .popper__arrow {
    background-color: transparent !important;
    // background-color:#001529 ;
    left: -7px !important;
  }

  .popper__arrow::after {
    border-right-color: #001529 !important;
    left: 0px !important;
  }

  &.on {
    opacity: 1;
    background-color: #3f7cff;
  }

  .popover-menu-item {
    height: 30px;
    padding: 5px 5px;
    opacity: 0.8;
    color: #ffffff !important;
    cursor: pointer;
  }

  .popover-menu-item:hover {
    opacity: 1;
  }
}

.el-icon-loading {
  font-size: 40px;
}

/* 页面公共样式 */
.page-layout {
  background-color: #fff;
  padding: 15px;
  border-radius: 5px;
  width: 100%;
  height: 100%;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
}

::v-deep .data-table {
  .tab-title {
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9e9e9;
  }
}

::v-deep .data-count {
  @include flex-row;
  height: 40px;
  margin: 10px 0;
  align-items: center;
  color: rgba(0, 0, 0, 0.65);
  opacity: 0.8;
  font-size: 14px;
  font-weight: bold;
  padding-left: 10px;
  background-color: #fff8d2;
  border-radius: $uni-border-radius;

  text {
    color: #1890ff;
    font-weight: 400;
    padding: 0 4px;
  }

  .el-icon-warning {
    color: #1890ff;
    padding-right: 3px;
  }
}
</style>
